In ubuntu 16.04 I have in bashrc:
alias python=python3.6
In other words, the command python starts python 3.6.
Now I want a virtualenv with python 2.7.
I have installed virtualenv:
virtualenv -p python2 pgadmin4
Then activated it.
Now check:
$ which python
/home/michael/PycharmProjects/venv/pgadmin4/bin/python
Doublecheck:
(pgadmin4) michael#michael-desktop:~/PycharmProjects/venv/pgadmin4/bin$ ls -la
total 3516
drwxrwxr-x 2 michael michael 4096 окт 12 13:05 .
drwxrwxr-x 7 michael michael 4096 окт 12 13:05 ..
-rw-rw-r-- 1 michael michael 2102 окт 12 13:05 activate
-rw-rw-r-- 1 michael michael 1044 окт 12 13:05 activate.csh
-rw-rw-r-- 1 michael michael 2242 окт 12 13:05 activate.fish
-rw-rw-r-- 1 michael michael 1137 окт 12 13:05 activate_this.py
-rwxrwxr-x 1 michael michael 272 окт 12 13:05 easy_install
-rwxrwxr-x 1 michael michael 272 окт 12 13:05 easy_install-2.7
-rwxrwxr-x 1 michael michael 244 окт 12 13:05 pip
-rwxrwxr-x 1 michael michael 244 окт 12 13:05 pip2
-rwxrwxr-x 1 michael michael 244 окт 12 13:05 pip2.7
lrwxrwxrwx 1 michael michael 7 окт 12 13:05 python -> python2
-rwxrwxr-x 1 michael michael 3546104 окт 12 13:05 python2
lrwxrwxrwx 1 michael michael 7 окт 12 13:05 python2.7 -> python2
-rwxrwxr-x 1 michael michael 2361 окт 12 13:05 python-config
-rwxrwxr-x 1 michael michael 251 окт 12 13:05 wheel
Well, just writing python must run python2.
But:
$ python
Python 3.6.2 (default, Jul 20 2017, 08:43:29)
Could you give me a kick here?
When you activate a virtualenv, under the hood, the PATH environment variable is rewritten to give more priority to the bin directory of your virtualenv.
The which python command tells you the path you expect because it ignores any alias eventually configured. It looks at the PATH environment variable and tries to resolve the current python path.
Bash, instead, takes into account all the alias configured and when you types python, bash resolves the command to python3.6 which is not in you virtualenv bin directory and goes to the system one.
The only possible solutions are:
remove the alias
add a symlink python3.6 -> python inside the bin folder of your virtualenv
Related
Got this line of code in .git/hooks/post-checkout:
exec vim +PackerCompile +"sleep 100m" +qall
The vim command ran fine from the command line. But apparently, not so well in sh.
When I switch to a branch, I get a very messy output:
Switched to branch 'clean'
Your branch is up to date with 'origin/clean'.
Vim: Warning: Input is not from a terminal
Even worse, my directory listings are all screwy:
> $ ls -la [±clean ✓]
total 4
drwxr-xr-x 6 user staff 192 Feb 26 20:59 .
drwxr-xr-x 5 user staff 160 Feb 26 16:39 ..
drwxr-xr-x 3 user staff 96 Feb 26 16:55 .compiled_packer_config
drwxr-xr-x 5 user staff 160 Feb 26 20:59 lua
drwxr-xr-x 19 user staff 608 Feb 20 16:56 templates
-rw-r--r-- 1 user staff 279 Feb 26 20:59 init.lua
It looks like I've got some whitespace characters in there. These whitespace characters are showing up in all directories in this terminal. In other terminals, things display normally. But WTF happened? And how do I fix?
OK, I stuck with what I'm more familiar with and used bash. Works just fine:
#!/bin/zsh
#exec git update-server-info
bash -c '/usr/local/bin/nvim +PackerCompile +"sleep 100m" +qall'
On my Ubuntu 16.04 I'm trying to build freetype-2.8 and libgd-2.2.4.
Here is how I build freetype2:
./configure \
--prefix=/home/stephane/programs/install \
--with-bzip2
make
make install
make clean
Here is how I build libgd:
./configure \
--prefix=/home/stephane/programs/install \
--with-jpeg=/home/stephane/programs/install \
--with-png=/home/stephane/programs/install \
--with-freetype=/home/stephane/programs/install \
--with-zlib=/home/stephane/programs/install \
--with-xpm
The configure command reports it finds freetype2:
Support for Freetype 2.x library: yes
But the make fails with the error:
gdft.c:154:22: fatal error: ft2build.h: No such file or directory
I can see freetype2 was installed in the following directories:
$ ll /home/stephane/programs/install/lib/libfreetype.*
-rw-r--r-- 1 stephane stephane 6752986 août 11 06:39 /home/stephane/programs/install/lib/libfreetype.a
-rwxr-xr-x 1 stephane stephane 1068 août 11 06:39 /home/stephane/programs/install/lib/libfreetype.la*
lrwxrwxrwx 1 stephane stephane 21 août 11 06:39 /home/stephane/programs/install/lib/libfreetype.so -> libfreetype.so.6.14.0*
lrwxrwxrwx 1 stephane stephane 21 août 11 06:39 /home/stephane/programs/install/lib/libfreetype.so.6 -> libfreetype.so.6.14.0*
-rwxr-xr-x 1 stephane stephane 3219752 août 11 06:39 /home/stephane/programs/install/lib/libfreetype.so.6.14.0*
$ ll /home/stephane/programs/install/include/freetype2/
total 16
drwxrwxr-x 3 stephane stephane 4096 août 11 06:39 ./
drwxrwxr-x 4 stephane stephane 4096 août 11 06:59 ../
drwxrwxr-x 3 stephane stephane 4096 août 11 06:39 freetype/
-rw-r--r-- 1 stephane stephane 2383 août 11 06:39 ft2build.h
And there are no freetype2 header files in the /home/stephane/programs/install/include/ directory:
$ ll /home/stephane/programs/install/include/
total 252
drwxrwxr-x 4 stephane stephane 4096 août 11 06:59 ./
drwxrwxr-x 9 stephane stephane 4096 août 10 23:20 ../
drwxrwxr-x 3 stephane stephane 4096 août 11 06:39 freetype2/
-rw-r--r-- 1 stephane stephane 1757 août 11 00:24 jconfig.h
-rw-r--r-- 1 stephane stephane 14580 août 11 00:24 jerror.h
-rw-r--r-- 1 stephane stephane 14925 août 11 00:24 jmorecfg.h
-rw-r--r-- 1 stephane stephane 49287 août 11 00:24 jpeglib.h
drwxrwxr-x 2 stephane stephane 4096 août 11 05:59 libpng16/
lrwxrwxrwx 1 stephane stephane 18 août 11 05:59 pngconf.h -> libpng16/pngconf.h
lrwxrwxrwx 1 stephane stephane 14 août 11 05:59 png.h -> libpng16/png.h
lrwxrwxrwx 1 stephane stephane 21 août 11 05:59 pnglibconf.h -> libpng16/pnglibconf.h
-rw-r--r-- 1 stephane stephane 35028 août 11 06:49 t1tables.h
-rw-r--r-- 1 stephane stephane 16262 août 5 14:37 zconf.h
-rw-r--r-- 1 stephane stephane 96239 août 5 14:37 zlib.h
How to have freetype2 install its header files in the expected include directory ?
Note: I know I could install a package using sudo apt-get install -y libfreetype6-dev but this is not what I want. I want to build it myself.
I upgraded the release of GD to libgd-2.2.5 but the exact same error keeps occurring.
By using the 2.7.1 version of freetype I can build GD just fine.
There is something that changed in freetype from freetype-2.7.1 to freetype-2.8.* that breaks the build of libgd-2.2.4 or libgd-2.2.5.
I am getting:
Can't locate JSON/XS.pm in #INC (you may need to install the JSON::XS module)
(#INC contains:
/usr/local/lib/perl5/site_perl/5.24.1/darwin-2level
/usr/local/lib/perl5/site_perl/5.24.1
/usr/local/lib/perl5/5.24.1/darwin-2level
/usr/local/lib/perl5/5.24.1
.
) at get.pl line 13.
(Line breaks added for readability.)
I have tried installing this module using cpan and getting the following message:
Can't write to cpanm home '/Users/sa/.cpanm': You should fix it with chown/chmod first.
I was wondering on what and where to find it to fix it?
$ ls -al ~/.cpanm
total 16
drwxr-xr-x 5 root staff 170 Feb 20 10:37 .
drwxr-xr-x+ 50 sa staff 1700 Feb 20 13:51 ..
lrwxr-xr-x 1 root staff 51 Feb 20 10:37 build.log -> /Users/sa/.cpanm/work/1487615857.2117/build.log
lrwxr-xr-x 1 root staff 41 Feb 20 10:37 latest-build -> /Users/sa/.cpanm/work/1487615857.2117
drwxr-xr-x 4 root staff 136 Feb 20 10:37 work
You did sudo cpanm at some point, and it created files in your home directory that belong to root instead of sa. Fix:
sudo chown -R sa:staff ~/.cpanm
In the future, use cpanm --sudo instead of sudo cpanm to avoid this problem. (It also avoid using root until necessary.)
I have a question about Emacs customisation.
For example, there is a git repo like https://github.com/bbatsov/projectile.
The directory structure is like:
-rw-r--r-- 1 haoruan staff 12K Nov 7 16:30 CHANGELOG.md
-rw-r--r-- 1 haoruan staff 1.5K Nov 7 16:30 CONTRIBUTING.md
-rw-r--r-- 1 haoruan staff 138B Nov 7 16:30 Cask
-rw-r--r-- 1 haoruan staff 884B Nov 7 16:30 Makefile
-rw-r--r-- 1 haoruan staff 28K Nov 7 16:30 README.md
-rw-r--r-- 1 haoruan staff 39K Nov 7 16:30 helm-projectile.el
-rw-r--r-- 1 haoruan staff 4.4K Nov 7 16:30 persp-projectile.el
-rw-r--r-- 1 haoruan staff 112K Nov 7 16:30 projectile.el
drwxr-xr-x 7 haoruan staff 238B Nov 7 16:30 screenshots
drwxr-xr-x 3 haoruan staff 102B Nov 7 16:30 script
drwxr-xr-x 7 haoruan staff 238B Nov 7 16:30 test
drwxr-xr-x 3 haoruan staff 102B Nov 7 16:30 travis
It is suggested that the recommended way to install this feature is using MELPA. I can clone this git repo, but I can not ping MELPA. My question is how can I manually install this Emacs feature? More generic, how can I manually install such a Emacs feature which is using cask?
In your example,you dose not need cask
git clone https://github.com/bbatsov/projectile /some/place/you/want
Then add
(add-to-load-path "/some/place/you/want")
in your .emacs or init.el.Then
(require 'projectile)
manually.
I have to include the pandas library in my package to run my software on a cluster server without pandas library installed but with all the right dependencies.
I tried to build on my pc the pandas library from source (ver. 0.8.1):
python setup.py build_ext --inplace
and if I move the builded pandas folder anywhere in some other folder in my pc I can import it in my software (ex ./mySoftwareFolder/pandas)
But when I move my software with pandas libray on the cluster server it raise me the error:
File "testPandas.py", line 9, in <module>
import pandas
File "/home/TEST/pandas/__init__.py", line 15, in <module>
raise ImportError('C extensions not built: if you installed already '
ImportError: C extensions not built: if you installed already verify that you are not importing from the source directory
like if it is not compiled.
What is wrong in my way to include library?
thanks a lot!
update:
the directory that I copy to cluster server contains:
-bash-4.2$ ll -a pandas
totale 11476
drwxr-xr-x. 14 francesco dottor 4096 1 set 13.37 .
drwxr-xr-x. 10 francesco dottor 8192 1 set 13.36 ..
-rwxr-xr-x. 1 francesco dottor 2648299 1 set 13.36 _algos.so
drwxr-xr-x. 2 francesco dottor 4096 1 set 13.36 compat
drwxr-xr-x. 2 francesco dottor 4096 1 set 13.36 core
-rw-r--r--. 1 francesco dottor 394 1 set 13.36 info.py
-rw-r--r--. 1 francesco dottor 557 1 set 13.36 info.pyc
-rw-r--r--. 1 francesco dottor 1269 1 set 13.36 __init__.py
-rw-r--r--. 1 francesco dottor 1643 1 set 13.37 __init__.pyc
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 io
-rwxr-xr-x. 1 francesco dottor 7437108 1 set 13.36 lib.so
-rwxr-xr-x. 1 francesco dottor 474199 1 set 13.36 _period.so
drwxr-xr-x. 2 francesco dottor 4096 1 set 13.36 rpy
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 sandbox
-rw-r--r--. 1 francesco dottor 844 1 set 13.36 setup.py
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 sparse
-rwxr-xr-x. 1 francesco dottor 1065313 1 set 13.36 _sparse.so
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 src
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 stats
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 tests
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 tools
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 tseries
drwxr-xr-x. 2 francesco dottor 4096 1 set 13.36 util
-rw-r--r--. 1 francesco dottor 42 1 set 13.36 version.py
-rw-r--r--. 1 francesco dottor 204 1 set 13.36 version.pyc
What platform are you building the C extensions on? On the cluster machine, verify that the extension shared objects (.so files on Linux/OSX and .pyd files on Windows) are in the folder you copied:
08:21 ~/code/pandas/pandas $ ll
total 12568
-rw-r--r-- 1 wesm staff 1269 Aug 25 04:49 __init__.py
-rw-r--r-- 1 wesm staff 1645 Aug 25 04:52 __init__.pyc
-rwxr-xr-x 1 wesm staff 799464 Aug 25 04:50 _algos.so
-rwxr-xr-x 1 wesm staff 65712 Aug 25 04:48 _engines.so
-rwxr-xr-x 1 wesm staff 197056 Sep 1 22:13 _period.so
-rwxr-xr-x 1 wesm staff 341032 Aug 25 04:53 _sparse.so
drwxr-xr-x 6 wesm staff 204 Aug 25 04:52 compat
drwxr-xr-x 44 wesm staff 1496 Sep 1 17:34 core
drwxr-xr-x 3 wesm staff 102 Aug 25 04:49 finance
-rw-r--r-- 1 wesm staff 394 Aug 25 04:49 info.py
-rw-r--r-- 1 wesm staff 535 Aug 25 04:52 info.pyc
drwxr-xr-x 15 wesm staff 510 Sep 1 23:14 io
-rwxr-xr-x 1 wesm staff 2490600 Sep 1 22:13 lib.so
drwxr-xr-x 9 wesm staff 306 Sep 1 17:34 rpy
drwxr-xr-x 6 wesm staff 204 May 20 19:13 sandbox
-rw-r--r-- 1 wesm staff 844 Feb 22 2012 setup.py
drwxr-xr-x 17 wesm staff 578 Aug 25 04:52 sparse
drwxr-xr-x 55 wesm staff 1870 Sep 1 22:57 src
drwxr-xr-x 23 wesm staff 782 Aug 25 04:52 stats
drwxr-xr-x 40 wesm staff 1360 Sep 1 17:34 tests
drwxr-xr-x 16 wesm staff 544 Aug 25 04:52 tools
drwxr-xr-x 28 wesm staff 952 Sep 1 17:34 tseries
drwxr-xr-x 18 wesm staff 612 Aug 25 04:52 util
-rw-r--r-- 1 wesm staff 54 Sep 1 22:57 version.py
-rw-r--r-- 1 wesm staff 204 Sep 1 22:58 version.pyc