For running of one of my C++ programs, using terminal(Ubuntu) I use
Note: I'm trying to Embed Python in C++. Hence, PYTHONPATH in C++.
Refer to Python/C API for more details.
$ PYTHONPATH=. ./prog_name
Sorry, I didn't know how to ask this question on Google. I want to do the same running with Eclipse. I don't know where to specify PYTHONPATH=. during running from Eclipse. How to produce the equivalent of this? I tried putting in argument list, but obviously it didn't work. Thanks!
PS. Don't downvote just because you don't understand that python scripts can be called through C++ .. Lol
Hi to all those facing the same problem, i found the solution!
setenv() is a function defined in which sets the environment variable. Just have to run it!
setenv("PYTHONPATH",".",1);
for more info on setenv:
$ man setenv
All the best :)
Related
There are two versions of MATLABs (2007a and 2019a) installed on my computer. The 2019a is installed after 2007a so if you use the following code in batch file:
start matlab -r "xxx.m"
The system will call 2019a instead of 2007a.
I searched online and found that most of people say you can call older version by:
start "C:\Program Files (x86)\MATLAB\2007a\bin\win32\MATLAB.exe" -r "xxx.m"
I tried but it give me this error:
if the batch file doesn't include any command ("-r" etc.), it works just fine. MATLAB can be opened without problems.
What's the mistake I made? How could I call older version and have it run some functions?
My OS: Win7
Thanks for all of guys who commented under my question. Turned out there are two ways to do this.
As one of comment said, you just need a pair of "" after start:
start "" "C:\path\MATLAB.exe" -r "xxx.m"
You actually don't need "start", just use directory is fine:
"C:\path\MATLAB.exe" -r "xxx.m"
Both ways solve the problem. A good lesson to learn for starters.
I know this post is old. But I was searching for a solution and found one by myself. The best way is to change the order of the windows environment variables. just put the older version over the newer one and you can use the old script.
I am trying to start a new PyDev Project and first need to setup the interpreter. The auto-config does not find a "valid interpreter". And so I must manual config. Perhaps someone with experience in this procedure knows of the specific name for the Interpreter Executable I am looking for. Thanks!
To get the interpreter you need to use, start the python interactive console in a shell and then do:
import sys; print(sys.executable)
The path printed is the interpreter you should use.
As a note, PyDev 4.6.0 is pretty old already, so, my suggestion would be upgrading to the latest release as many things were improved in the meanwhile.
I am very, very new to NLP and the like. Therefore, I have a very basic question. I want to POS-tag an corpus of files with TreeTagger using a Mac OSX 10.6.8. I have installed TreeTagger by using the instructions provided at http://www.cis.uni-muenchen.de/~schmid/tools/TreeTagger/
[I installed it in /Applications]
Then I have installed Lingua-TreeTagger-0.06 for 'for calling the TreeTagger and manipulating its output'. This took a lot of effort to do.
[I installed it in /Applications]
I think I have succeeded in the previous steps. Now what? I mean how do I call Tree-Tagger?
Thanks to anybody who could help me?
mc
Lingua::TreeTagger is a Perl module that is useful only if you want to use TreeTagger from within a Perl script. Examples of how to do so are given in the module's online documentation. Otherwise you should call the tree-tagger application from the terminal as commented by Patrick J.S. above (unless you are on Windows, where a user-friendly graphical interface is available).
I am new user of IntelliJ IDE. I was successfully able to set the run/debug configuartions for my Jave programs by choosing
New Configuration->Application->Specifying Java Main class and the
Program args
But I have some Perl scripts in my application and was wondering how to do that. I don't see an option for adding a new configuration for perl scripts.
Any help of how to do this or explanation on why it cant be done would be much helpful
Thanks
It does now: https://plugins.jetbrains.com/plugin/7796
debugging is now supported too the same way as in other languages
IntelliJ does not support perl
https://plugins.jetbrains.com/wishlist/show?pr=&wid=368
Which is a pity
I want to build html docs using a virtualenv instead of the native environment on my machine.
I've entered the virtualenv but when I run make html I get errors saying the module can't be imported - I know the errors are due to the module being unavailable in my native environment.
How can I specify which environment should be used when searching for docs (eg the virtualenv)?
The problem is correctly spotted by Mathijs.
$ which sphinx-build
/usr/local/bin/sphinx-build
I solved this issue installing sphinx itself in the virtual environment.
With the environment activated:
$ source /home/migonzalvar/envs/myenvironment/bin/activate
$ pip install sphinx
$ which sphinx-build
/home/migonzalvar/envs/myenvironment/bin/sphinx-build
It seems neat enough.
The problem here is that make html uses the sphinx-build command as a normal shell command, which explicitly specifies which Python interpreter to use in the first line of the file (ie. #!/usr/bin/python). If Python gets invoked in this way, it will not use your virtual environment.
A quick and dirty way around this is by explicitly calling the sphinx-build Python script from an interpreter. In the Makefile, this can be achieved by changing SPHINXBUILD to the following:
SPHINXBUILD = python <absolute_path_to_sphinx-build-file>/sphinx-build
If you do not want to modify your Makefile you can also pass this parameter from the command line, as follows:
make html SPHINXBUILD='python <path_to_sphinx>/sphinx-build'
Now if you execute make build from within your VirtualEnv environment, it should use the Python interpreter from within your environment and you should see Sphinx finding all the goodies it requires.
I am well aware that this is not a neat solution, as a Makefile like this should not assume any specific location for the sphinx-build file, so any suggestions for a more suitable solution are warmly welcomed.
I had the same problem, but I couldn't use the accepted solution because I didn't use the Makefile. I was calling sphinx-build from within a custom python build file. What I really wanted to do was to call sphinx-build with the exact same environment that I was calling my python build script with. Fiddling with paths was too complicated and error prone, so I ended up with what seems to me like an elegant solution, which is to "manually" load the console script entry point and call it:
from pkg_resources import load_entry_point
cmd = load_entry_point('Sphinx', 'console_scripts', 'sphinx-build')
cmd(['sphinx-build', basepath, destpath])